package org.batatasframework.chart.columns;

public class ColumnAxisMonthly extends AbstractValueColumn<String> implements ChartColumnAxis{
	
	private final int annualIndex;
	private final String annualName;
	private final int monthIndex;
	private final String monthName;

	public ColumnAxisMonthly(String name, int annualIndex, String annualName, int monthIndex, String monthName) {
		super(name);
		this.annualIndex = annualIndex;
		this.annualName = annualName;
		this.monthIndex = monthIndex;
		this.monthName = monthName;
	}

	public ColumnAxisMonthly(String name, int annualIndex, int monthIndex) {
		this(name, annualIndex, "年", monthIndex, "月");
	}

	@Override
	protected String internalParseValue(Object[] row) {
		String val = "";
		if(annualIndex < row.length) val = row[annualIndex] + annualName;
		if(monthIndex < row.length) val += row[monthIndex] + monthName;
		return val;
	}
}
